package com.lhdx.practical.dao;

import com.lhdx.practical.bean.Depart;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DepartDao extends CrudRepository<Depart,Long> {
    Depart findById(long id);
    void deleteById(long id);
    int countAllByPid(long pid);
    List<Depart> findAllByPidOrderBySortDesc(long pid);

    List<Depart> findAllByPidNotOrderBySortDesc(long pid);

    Page<Depart> findAll(Specification<Depart> spec, Pageable pageable);


    int countAllByDepartname(String departname);
}
